package com.github.thinwonton.springboot.showcase.jta.mybatisplus.payment.service;

import com.github.thinwonton.springboot.showcase.jta.mybatisplus.account.service.AccountService;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.orders.service.OrdersService;
import com.github.thinwonton.springboot.showcase.jta.mybatisplus.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class PaymentService {

    @Autowired
    private AccountService accountService;

    @Autowired
    private OrdersService ordersService;

    @Autowired
    private UserService userService;

    @Transactional(rollbackFor = Exception.class)
    public void testForRollback() {
        accountService.createAccount();
        ordersService.createOrder();
        userService.createUser("hugo_" + System.currentTimeMillis());
        int result = 1 / 0;
    }
}
